import {PartialType} from '@nestjs/mapped-types';
import {CreateRoleDto} from './create-role.dto';
import {IsNotEmpty, IsOptional, IsString, Length} from "class-validator";
import {ApiProperty} from "@nestjs/swagger";

export class UpdateRoleDto extends PartialType(CreateRoleDto) {
    @ApiProperty({description: 'id'})
    @IsString({message: 'id 类型错误，正确类型 number'})
    @IsNotEmpty({message: 'id 不能为空'})
    id: string

    @ApiProperty({description: '角色名称'})
    @IsString({message: 'remark 类型错误, 正确类型 string'})
    @Length(2, 20, {message: 'name 字符长度在 2~20'})
    name?: string

    @ApiProperty({description: '角色备注', required: false})
    @IsString({message: 'remark 类型错误, 正确类型 string'})
    @Length(0, 100, {message: 'name 字符长度在 0~100'})
    @IsOptional()
    remark?: string
}
